#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from dragon.selector import Selector
from dragon.page import DraPage

class StockDetailSe:
    stockName=Selector('div.detail-head-left > span.stock-name','股票名称')
    stock=Selector('div.detail-head-left','股票')
    stockCode=Selector('div.detail-head-left > span.stock-num','股票代码')
    selectedShortcutDate=Selector('div.blue-box>div.date-monthday','选中的快捷日期')
    shortcutDate=Selector('div.date-monthday','快捷日期选项')
    selectedMainForceButton=Selector('div.track-box > div.tabs-box > div> div.tabs-item.active','选中的主力轨迹标签')
    dayTrack=Selector('text=当日轨迹','当日轨迹按钮')
    monthTrack = Selector('text=月度轨迹', '月度轨迹按钮',)
    trackDetail=Selector('text=轨迹详情','轨迹详情按钮')
    startDate=Selector('div.twoDate>div:nth-child(1)','开始时间按钮')
    endDate=Selector('div.twoDate>div:nth-child(3)','结束时间按钮')
    changeCount=Selector('div.count>span','资金次数')
    changeTime=Selector('div.time','异动时间')
    changeDetail=Selector('div.today-box>div','异动详情')
    changeDetailTime=Selector('div.today-box>div>div>div:nth-child(3)','异动时间(异动详情)')
    trackDetailDate=Selector('td.el-table_1_column_2.el-table__cell > div > div','轨迹日期(轨迹详情)')
    selectedKlineButton=Selector('div.k-line > div.tabs-box > div> div.tabs-item.active','选中的k线选项')
    dayK = Selector('text=日线', '日线选项')
    weekK = Selector('text=周线', '周线选项')
    monthK = Selector('text=月线', '月线选项')
    dayKChart=Selector('div#Kdate > div:nth-child(1) > canvas','日线图表')
    dayKDetailFloat=Selector('div#Kdate > div:nth-child(2)','日线详情浮窗')
    weekKChart=Selector('div#Kfive > div:nth-child(1) > canvas','周线图表')
    weekKDetailFloat=Selector('div#Kfive > div:nth-child(2)','周线详情浮窗')
    monthKChart=Selector('div#Kweek > div:nth-child(1) > canvas','月线图表')
    monthKDetailFloat=Selector('div#Kweek > div:nth-child(2)','月k线详情浮窗')
    calendarButton = Selector('div.date-text', '日历按钮')
    # shareButton=Selector('分享','分享按钮','text')
    shareButton=Selector('div.footer-box > div > div:nth-child(1) > div > div.footer-nav-flex > svg','分享按钮')
    subscribeButton=Selector('div.footer-box > div > div:nth-child(1) > div > div:nth-child(2) > div > svg','加自选按钮')
    isSubscribed=Selector('div.footer-box > div > div:nth-child(1) > div > div:nth-child(2) > div > div','是否加自选标志')
    alert=Selector('p.el-message__content','提示')
    previousButton=Selector('text=上一支','上一支按钮')
    nextButton = Selector('text=下一支', '下一支按钮')

class StockDetailPage:
    def __init__(self, draPage: DraPage):
        self.draPage=draPage
        self.stockName = draPage.locator(StockDetailSe.stockName)
        self.stock = draPage.locator(StockDetailSe.stock)
        self.stockCode = draPage.locator(StockDetailSe.stockCode)
        self.selectedShortcutDate = draPage.locator(StockDetailSe.selectedShortcutDate)
        self.shortcutDate = draPage.locator(StockDetailSe.shortcutDate)
        self.selectedMainForceButton = draPage.locator(StockDetailSe.selectedMainForceButton)
        self.dayTrack = draPage.locator(StockDetailSe.dayTrack)
        self.monthTrack = draPage.locator(StockDetailSe.monthTrack)
        self.trackDetail = draPage.locator(StockDetailSe.trackDetail)
        self.startDate = draPage.locator(StockDetailSe.startDate)
        self.endDate = draPage.locator(StockDetailSe.endDate)
        self.changeCount = draPage.locator(StockDetailSe.changeCount)
        self.changeTime = draPage.locator(StockDetailSe.changeTime)
        self.changeDetail = draPage.locator(StockDetailSe.changeDetail)
        self.changeDetailTime = draPage.locator(StockDetailSe.changeDetailTime)
        self.trackDetailDate = draPage.locator(StockDetailSe.trackDetailDate)
        self.selectedKlineButton = draPage.locator(StockDetailSe.selectedKlineButton)
        self.dayK = draPage.locator(StockDetailSe.dayK)
        self.weekK = draPage.locator(StockDetailSe.weekK)
        self.monthK = draPage.locator(StockDetailSe.monthK)
        self.dayKChart = draPage.locator(StockDetailSe.dayKChart)
        self.dayKDetailFloat = draPage.locator(StockDetailSe.dayKDetailFloat)
        self.weekKChart = draPage.locator(StockDetailSe.weekKChart)
        self.weekKDetailFloat = draPage.locator(StockDetailSe.weekKDetailFloat)
        self.monthKChart = draPage.locator(StockDetailSe.monthKChart)
        self.monthKDetailFloat = draPage.locator(StockDetailSe.monthKDetailFloat)
        self.calendarButton = draPage.locator(StockDetailSe.calendarButton)
        self.shareButton = draPage.locator(StockDetailSe.shareButton)
        self.subscribeButton = draPage.locator(StockDetailSe.subscribeButton)
        self.isSubscribed = draPage.locator(StockDetailSe.isSubscribed)
        self.alert = draPage.locator(StockDetailSe.alert)
        self.previousButton = draPage.locator(StockDetailSe.previousButton)
        self.nextButton = draPage.locator(StockDetailSe.nextButton)

